<#include "../base.ftl"/>
<#macro cssfile>
</#macro>

<#macro scriptfile>
</#macro>

<#macro breadcrumb>
    <ul class="breadcrumb">
    <#include "../index-menu.ftl"/>
    <li class="active">舱单文件列表</li>
    </ul>
</#macro>

<#macro title>
广大物流云平台
</#macro>
<#macro jsscript>
$(function(){
    $("#gridTable").jqGrid({
            //list表格数据获取地址
            url:'${request.contextPath}/list/mainConsole/tsmLading/list.html',
            datatype: "json",
            mtype:"POST",
            height: 400,
            colNames:['舱单编号',
                      '航次编号',
                      '提单号',
                      '订舱号',
                      '起运港',
                      '中转港',
                      '卸货港',
                      '目的港',
                      'FDEST',
                      '柜号',
                      '封号',
                      '柜型',
                      '空重',
                      '箱属',
                      '重量(千克)',
                      '货名',
                      '冷柜温度',
                      '危品级别',
                      'UNNO',
                      '超高尺寸',
                      '左超宽尺寸',
                      '右超宽尺寸',
                      '前超宽尺寸',
                      '后超宽尺寸',
                      '二程船',
                      '头层船',
                      '备注',
                      '状态',
                      '创建人',
                      '创建日期',
                      '最后修改人',
                      '最后修改时间'
                      ],
            colModel:[
                {name:'ladingId',jsonmap:'LADING_ID',index:'LADING_ID',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'voyageId',jsonmap:'VOYAGE_ID',index:'VOYAGE_ID',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'ladingNo',jsonmap:'LADING_NO',index:'LADING_NO',hidden:true,align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'bookingNo',jsonmap:'BOOKING_NO',index:'BOOKING_NO',align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'dispatchPort',jsonmap:'DISPATCH_PORT',index:'DISPATCH_PORT',align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'transshipPort',jsonmap:'TRANSSHIP_PORT',index:'TRANSSHIP_PORT',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                
                {name:'dischargePort',jsonmap:'DISCHARGE_PORT',index:'DISCHARGE_PORT',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'destinationPort',jsonmap:'DESTINATION_PORT',index:'DESTINATION_PORT',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'fdest',jsonmap:'FDEST',index:'FDEST',hidden:true,align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'containerNo',jsonmap:'CONTAINER_NO',index:'CONTAINER_NO',align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'containerType',jsonmap:'CONTAINER_TYPE',index:'CONTAINER_TYPE',align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'sealNo',jsonmap:'SEAL_NO',index:'SEAL_NO',align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'emptyWeight',jsonmap:'EMPTY_WEIGHT',index:'EMPTY_WEIGHT',align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'containerBelongs',jsonmap:'CONTAINER_BELONGS',index:'CONTAINER_BELONGS',hidden:true,align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'weight',jsonmap:'WEIGHT',index:'WEIGHT',align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'cargoName',jsonmap:'CARGO_NAME',index:'CARGO_NAME',align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                
                {name:'freezerTemp',jsonmap:'FREEZER_TEMP',index:'FREEZER_TEMP',hidden:true,align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                
                {name:'hazardCategory',jsonmap:'HAZARD_CATEGORY',index:'HAZARD_CATEGORY',hidden:true,align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'unno',jsonmap:'UNNO',index:'UNNO',align:'center',hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                
                {name:'ultrahighSize',jsonmap:'ULTRAHIGH_SIZE',index:'ULTRAHIGH_SIZE',editable:false,hidden:true,align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'leftUltrawideSize',jsonmap:'LEFT_ULTRAWIDE_SIZE',index:'LEFT_ULTRAWIDE_SIZE',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'rightUltrawideSize',jsonmap:'RIGHT_ULTRAWIDE_SIZE',index:'RIGHT_ULTRAWIDE_SIZE',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'frontUltrawideSize',jsonmap:'FRONT_ULTRAWIDE_SIZE',index:'FRONT_ULTRAWIDE_SIZE',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'afterUltrawideSize',jsonmap:'AFTER_ULTRAWIDE_SIZE',index:'AFTER_ULTRAWIDE_SIZE',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'secondVessel',jsonmap:'SECOND_VESSEL',index:'SECOND_VESSEL',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'firstVessel',jsonmap:'FIRST_VESSEL',index:'FIRST_VESSEL',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'remark',jsonmap:'REMARK',index:'REMARK',editable:false,align:'center',searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'status',jsonmap:'STATUS',index:'STATUS',editable:false,hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},

                {name:'createdBy',jsonmap:'CREATED_BY',index:'CREATED_BY',hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'createdDate',jsonmap:'CREATED_DATE',index:'CREATED_DATE',hidden:true,searchoptions : {sopt : [ "eq", "cn" ]},
                    formatter : 'date',                
                    formatoptions : {srcformat : 'Y/m/d',newformat : 'Y-m-d'},
                    editoptions :  {dataInit: function(element) {
                        $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
                    }}
                },
                {name:'lastUpdBy',jsonmap:'LAST_UPD_BY',index:'LAST_UPD_DATE',hidden:true,searchoptions : {sopt : [ "eq", "cn" ]}},
                {name:'lastUpdDate',jsonmap:'LAST_UPD_DATE',index:'LAST_UPD_DATE',hidden:true,searchoptions : {sopt : [ "eq", "cn" ]},
                    formatter : 'date',                
                    formatoptions : {srcformat : 'Y/m/d',newformat : 'Y-m-d'},
                    editoptions :  {dataInit: function(element) {
                        $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
                    }}
                }     
            ],
            sortname:'LAST_UPD_DATE',
            sortorder:'desc',
            viewrecords : true,
            gridview : true,
            autowidth : true,
            rownumbers : true,
            ondblClickRow : function(id){
    			showAllInfo(id);
    		},
            rowNum : 20,
            rowList : [10,20,30],
            jsonReader : {
                page : "page.pageNo",
                total : "page.totalPages",
                records : "page.totalCount",
                root : "page.result",
                repeatitems : false,
                id : 'JOB_DTL_ID'
            },
            
            prmNames : {
                rows : "page.pageSize",
                page : "page.pageNo",
                sort : "page.orderBy",
                order : "page.order"
            },
            pager : "#gridPager",
            caption : "舱单文件列表"
        }).navGrid('#gridPager',{
                edit:false,
                add:false, 
                del:false, 
                search: true
        }, {
            //edit
            beforeShowForm: function(form) {},
            reloadAfterSubmit : true,
            closeAfterEdit : true, //修改完毕后关闭
            afterComplete : opertaionPrompt,
            beforeSubmit :validateSumbit
        }, {
            //add
            beforeShowForm: function(form) {},
            reloadAfterSubmit : true,
            closeAfterAdd : true, //新增完毕后关闭
            afterComplete : opertaionPrompt,
            //提交前进行验证
            beforeSubmit :validateSumbit 
        }, {
            //del
            reloadAfterSubmit : true,
            afterComplete : opertaionPrompt
        }, {
            //组合查询
            multipleSearch : true
       }).navButtonAdd('#gridPager',{
			caption:"查看详细信息",
			buttonicon:'ui-icon-add',
           onClickButton: function(){
           var selectedId = $("#gridTable").jqGrid("getGridParam", "selrow");
//           alert(selectId);
           if(selectedId==null){
               alert("您还未选择要查看的信息");
           } else {
           	//var consoleDlg=$("#dialogGrid");
               //consoleDlg.dialog("option","title","详细信息").dialog("open");
        	   showAllInfo(selectedId);
           }
       }
	});

        //提交前的验证，检验数据，并加入beanName
        function validateSumbit(postdata, formid){
            return [true,''];
        }
        
        function showAllInfo(id){
        	var ladingId = jQuery('#gridTable').jqGrid('getRowData',id).ladingId;
        	var voyageId = jQuery('#gridTable').jqGrid('getRowData',id).voyageId;
        	var ladingNo = jQuery('#gridTable').jqGrid('getRowData',id).ladingNo;
        	var bookingNo = jQuery('#gridTable').jqGrid('getRowData',id).bookingNo;
        	var dispatchPort = jQuery('#gridTable').jqGrid('getRowData',id).dispatchPort;
        	var transshipPort = jQuery('#gridTable').jqGrid('getRowData',id).transshipPort;
        	var dischargePort = jQuery('#gridTable').jqGrid('getRowData',id).dischargePort;
        	var destinationPort = jQuery('#gridTable').jqGrid('getRowData',id).destinationPort;      	
            var fdest = jQuery('#gridTable').jqGrid('getRowData',id).fdest;
            var containerNo = jQuery('#gridTable').jqGrid('getRowData',id).containerNo;
            var containerType = jQuery('#gridTable').jqGrid('getRowData',id).containerType;
            var sealNo = jQuery('#gridTable').jqGrid('getRowData',id).sealNo;
            var emptyWeight = jQuery('#gridTable').jqGrid('getRowData',id).emptyWeight;
            var containerBelongs = jQuery('#gridTable').jqGrid('getRowData',id).containerBelongs;
            var weight = jQuery('#gridTable').jqGrid('getRowData',id).weight;
            var cargoName = jQuery('#gridTable').jqGrid('getRowData',id).cargoName;
            var freezerTemp = jQuery('#gridTable').jqGrid('getRowData',id).freezerTemp;
            var hazardCategory = jQuery('#gridTable').jqGrid('getRowData',id).hazardCategory;
            var unno = jQuery('#gridTable').jqGrid('getRowData',id).unno;
            var ultrahighSize = jQuery('#gridTable').jqGrid('getRowData',id).ultrahighSize;
            var leftUltrawideSize = jQuery('#gridTable').jqGrid('getRowData',id).leftUltrawideSize;
            var rightUltrawideSize = jQuery('#gridTable').jqGrid('getRowData',id).rightUltrawideSize;
            var frontUltrawideSize = jQuery('#gridTable').jqGrid('getRowData',id).frontUltrawideSize;
            var afterUltrawideSize = jQuery('#gridTable').jqGrid('getRowData',id).afterUltrawideSize;
            var secondVessel = jQuery('#gridTable').jqGrid('getRowData',id).secondVessel;
            var firstVessel = jQuery('#gridTable').jqGrid('getRowData',id).firstVessel;
            var remark = jQuery('#gridTable').jqGrid('getRowData',id).remark;
            var status = jQuery('#gridTable').jqGrid('getRowData',id).status;
           
            var allData = {
            	    column : 2,
            	    data:[
            	        {label:"舱单编号",val : ladingId},
            	        {label:"船舶编码",val : voyageId},
            	        {label:"提单号",val : ladingNo},
            	        {label:"订舱号",val : bookingNo},
            	        {label:"起运港",val : dispatchPort},
            	        {label:"中转港",val : transshipPort},
            	        {label:"卸货港",val : dischargePort},
            	        {label:"目的港",val : destinationPort},
            	        {label:"FDEST",val : fdest},
            	        {label:"柜号",val : containerNo},
            	        {label:"柜型",val : containerType},
            	        {label:"封号",val : sealNo},
            	        {label:"空重",val : emptyWeight},
            	        {label:"箱属",val : containerBelongs},
            	        {label:"重量",val : weight},
            	        {label:"货名",val : cargoName},
            	        {label:"冷柜温度",val : freezerTemp},
            	        {label:"危品类型",val : hazardCategory},
            	        {label:"UNNO",val : unno},
            	        {label:"超高尺寸",val : ultrahighSize},
            	        {label:"左超宽尺寸",val : leftUltrawideSize},
            	        {label:"右超宽尺寸",val : rightUltrawideSize},
            	        {label:"前超宽尺寸",val : frontUltrawideSize},
            	        {label:"后超宽尺寸",val : afterUltrawideSize},
            	        {label:"二程船",val : secondVessel},
            	        {label:"头层船",val : firstVessel},
            	        {label:"备注",val : remark},
            	        {label:"状态",val : status}
        	         ]
            	    };
            initDetailDialog("dialogGrid",470,600);
		 	showDetail("dialogGrid",allData);
        }
});
</#macro>
<#macro main>
    <table id="gridTable"></table>
    <div id="gridPager"></div>
    <div id="dialogGrid" title="详细信息" style="display:none;text-align:center"></div>
</#macro>